#include <iostream>
#include "IntroHeader.h"
#include "ReadData.h"
#include "IntroAlgorithm.h"
#include "ConvexHullPoint.h"
#include "Graph.h"
using namespace std;

int main(int argc, char *argv[]) {
	vector<int> data;
	data = ReadData();
	
	cout<<"before sort--------"<<endl;
	copy(data.begin(), data.end(), ostream_iterator<int>(cout, " "));
	cout<<endl;

	//InsertionSort(data);
	//SelectionSort(data);
	//BubbleSort(data);
	//MergeSort(data);
	//QuickSort<int>(data);
	ShellSort(data);

	cout<<"after sort---------"<<endl;
	copy(data.begin(), data.end(), ostream_iterator<int>(cout, " "));
	cout<<endl;

#if 0	//BinarySearch
	while (true) {
		int ele;
		cout<<"data to search: "; cin>>ele;
		cout<<"result: "<<BinarySearch(data, ele)<<endl;
	}
#endif

	BinaryTree *root;
	CreateBinaryTree(data, &root);

	cout<<"Preorder Traversal: >>>>>>>>>>>"<<endl;
	PreorderTraversal(root);
	cout<<endl;

	cout<<"Inorder Traversal:  >>>>>>>>>>>"<<endl;
	InorderTraversal(root);
	cout<<endl;

	cout<<"Postorder Traversal: >>>>>>>>>>"<<endl;
	PostorderTraversal(root);
	cout<<endl;

	cout<<"Height of Binary Tree: "<<BinaryTreeHeight(root)<<endl;

	cout<<"Convex Hull Points: >>>>>>>>>>>"<<endl;
	vector<ConvexHullPoint> points;
	CreatePoints(points);
	copy(points.begin(), points.end(), ostream_iterator<ConvexHullPoint>(cout, " "));
	cout<<endl;

	cout<<"After sort->Points: >>>>>>>>>>>"<<endl;
	QuickSort<ConvexHullPoint>(points);
	copy(points.begin(), points.end(), ostream_iterator<ConvexHullPoint>(cout, " "));
	cout<<endl;

	//cout<<numeric_limits<double>::infinity()<<endl;
	
	cout<<"DFS search: >>>>>>>>>>>>>>>>>>>"<<endl;
	Graph *graph;
	CreateGraph(graph);
	DFS(graph);
	cout<<endl;

	cout<<"BFS search: >>>>>>>>>>>>>>>>>>>"<<endl;
	ClearGraphStatus(graph);
	BFS(graph);
	cout<<endl;

	return 0;
}
